<?php
	$this->load->helper('url');
	$this->load->helper('form');
?>

<html>
<head>
    	<title>ICS SAIS</title>
        
<link href="<?=base_url();?>style/design.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<?=base_url();?>style/jquery-ui.css" />
<script src="<?=base_url();?>js/jquery-1.9.1.js"></script>
<script src="<?=base_url();?>js/jquery-ui.js"></script>
<script src="<?=base_url();?>js/dialog.js"></script> 


<script type="text/javascript">
	 var RecaptchaOptions = { theme : 'white' };
	
	function form_type_display() {
		if (document.getElementById('type').value == 'student') {
			var className = 'student_form';
		} else if(document.getElementById('type').value == 'faculty'){
			var className = 'faculty_form';
		} else if(document.getElementById('type').value == 'encoder'){
			var className = 'encoder_form'
		}
		
		<!--get elements by class-->
		<!--http://stackoverflow.com/questions/3808808/how-to-get-element-by-class-in-javascript-->
		var elems = document.getElementsByTagName('*'), i;
		for (i in elems) {
			if((' ' + elems[i].className + ' ').indexOf(' ' + className + ' ')
					> -1) {
				elems[i].style.display = 'table-row';
			}
		}
	}
	
	function disable_all_forms(){
		var elems = document.getElementsByTagName('*'), i;
		var form_names = new Array();
		form_names[0] = 'student_form';
		form_names[1] = 'faculty_form';
		form_names[2] = 'encoder_form';
		for (h in form_names){
			for (i in elems) {
				if((' ' + elems[i].className + ' ').indexOf(' ' + form_names[h] + ' ')
						> -1) {
					elems[i].style.display = 'none';
				}
			}
		}
	}
</script>   

<script>
/*Change password jQuery*/
	/*Source:
		http://jqueryui.com/dialog/#modal-form
	*/
 $(function() {
    var name = $( "#name" ),
      email = $( "#email" ),
      password = $( "#password" ),
      allFields = $( [] ).add( name ).add( email ).add( password ),
      tips = $( ".validateTips" );
	  

    function updateTips( t ) {
      tips
        .text( t )
        .addClass( "ui-state-highlight" );
      setTimeout(function() {
        tips.removeClass( "ui-state-highlight", 1500 );
      }, 500 );
    }
 
    $( "#dialog-form" ).dialog({
      autoOpen: false,
      height: 250,
      width: 400,
      modal: true,
      buttons: {
        "Change Password": function() {
            //submit form to database
			$("#form_changepassword").submit();
            $( this ).dialog( "close" );
        },
        Cancel: function() {
          $( this ).dialog( "close" );
        }
      },
      close: function() {
        allFields.val( "" ).removeClass( "ui-state-error" );
      }
    });
 
    $( "#change_pw" )
      .click(function() {
        $( "#dialog-form" ).dialog( "open" );
      });
  });
/*Change password jQuery*/
	

</script>        

</head>
    
<body>
   	<div id="cont">
        	<div id="header_slim">
            	<div id="header_main">
                	<div id="mhleft">
                    </div>
                    
                    <div id="mhcenter">
                    	<img src="<?=base_url();?>style/ics_logo_blue.png" id="logo"/>
                      <div id="label_sais">
                        	<div id="border_label">	</div>
                        <div id="label"><p>Students'Academic
Information System</p></div>
                      </div>
                  </div>
                    
                    <div id="mhright">
                    </div>
                </div>
   
                <div id="bottomhead">
                	<div id="bhleft_slim">
                    </div>
                    <div id="menu_bar_slim">
                    	<!--menu -->
						<?php
							$this->load->helper('url');
						?>
                        <div class="header_link">
                        	<?php echo anchor('home/student_checklist','<h>Checklist</h>'); ?>
                        </div>
                  		
                  		<ul id="nav">
                        	<li>
                                <div class="header_link">
                                    <a><h>Advisers</h></a>
                                </div>
                                <ul>
                                	<div id="drop_down">
										
                                        <li><?php echo anchor('home/student_advisers/sp', '<h>SP Advisers</h>'); ?></li>
                                        <li><?php echo anchor('home/student_advisers/reg','<h>Registration Advisers</h>'); ?></li>
                                    </div>
                                </ul>
                                
                           	</li>
                        
                        </ul>
                        
                        
                        <div class="header_link">
                        	<?php	echo anchor('home/student_messages', '<h>Messages</h>'); ?>
                        </div>
                        <div class="header_link">
                        	<?php echo anchor('home/student_univcases','<h>Cases</h>'); ?>
                        </div>
						<div class="header_link">
                        	<?php echo anchor('home/student_subjects','<h>Subjects</h>'); ?>
                        </div>
						<div class="header_link_right header_link">
                        	<?php echo anchor('home/student_info','<h>Basic Info</h>'); ?>
                        </div>
                    </div>
                </div>
            </div>
            
      <div id="body_user">
      	<div id="body_border_user">	<!--light blue border-->
        </div>
    <?php 
			
		foreach($student as $row){
			
		
	?>
        <div id="main_body">
			<!--jQuery Dialog-->
			<div id="dialog-form" title="Edit Password">

				<?php
					$attr = array('id'=>'form_changepassword');
					echo form_open('home/change_password',$attr); 
				?>
					<table>
						<tr>
							<td colspan=1><label class="info_text" for="current_password">Current Password&nbsp;&nbsp;</label></td>
							<td colspan=1><input type="password" id="current_password" class="student_edit" pattern="[A-Za-z]+" required></td>
						</tr>
						<tr>
							<td colspan=1><label class="info_text" for="new_password1">New Password&nbsp;&nbsp;</label></td>
							<td colspan=1><input type="password" id="new_password1" class="student_edit" pattern="[A-Za-z]+" required></td>
						</tr>
						<tr>
							<td colspan=1><label class="info_text" for="new_password2">Re-Enter New Password&nbsp;&nbsp;</label></td>
							<td colspan=1><input type="password" id="new_password2" class="student_edit" pattern="[A-Za-z]+" required></td>
						</tr>
					</table>
					
				<?php 
					echo form_close(); 
				?>
			</div>
			<!--jQuery Dialog-->
            <table id="student_info">
                <tr>
					<?php $imgurl = $row->Student_No.".JPG";?>
                    <td rowspan=4 colspan=2><img src="<?php echo base_url().'user_images/'.$imgurl;?>" style="width:120px;height:120px;" id="user_img"/></td>
                    <td rowspan=1 colspan=2><h2 class="info_text" id="bsinfo">Basic Information</h2></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=1><h2 class="info_text">Name: </h2></td>
                    <td rowspan=1 colspan=1><h3 class="info_text">&nbsp;&nbsp;<?php echo $row->Last_Name.', '.$row->First_Name.' '.$row->Middle_Name; ?></h3></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=2><p class="info_text"><b>Student Number:</b>&nbsp;&nbsp;<?php echo $row->Student_No; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=2><p class="info_text"><b>Course:</b>&nbsp;&nbsp;BSCS</p></td>
                </tr>
                <tr> 
                    <td rowspan=1 colspan=2 class="info_text"><?php echo anchor('/home/student_info_editview/', '<pre class="info_text">Edit Basic Info</pre>'); ?></td>
                    <td rowspan=1 colspan=2><p class="info_text"><b>Mobile Number:</b>&nbsp;&nbsp;<?php echo "0".$row->Mobile_No; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=2><pre  class="info_text" id="change_pw" style="cursor:pointer;">Edit Password</pre></td>
                    <td rowspan=1 colspan=2><p class="info_text"><b>Email:</b>&nbsp;&nbsp;<?php echo $row->Email_Address; ?></p></td>
                </tr>
                <tr>
                	<td rowspan=1 colspan=1>&nbsp;</td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=4><p class="info_text"><b>Home Address:</b> <?php echo $row->Home_Address; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=4><p class="info_text"><b>Home Contact No.:</b> <?php echo $row->Home_Contact; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=4><p class="info_text"><b>College Address:</b> <?php echo $row->College_Address; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=4><p class="info_text"><b>College Contact No.:</b> <?php echo $row->College_Contact; ?></p></td>
                </tr>
                <tr>
                    <td rowspan=1 colspan=4><p class="info_text"><b>Curriculum Taken:</b> <?php echo $row->Curriculum_Taken; ?></p></td>
                </tr>
            </table>
         </div>
      <?php
		}
	  ?>
      </div>
	  <div id="footer">
			<pre class="info_text">Created by parehiville. CMSC128 2nd Semester SY 2012-2013</pre>
	  </div>
	</div>
</body>